package com.start.workflow.core.api;

import com.start.common.api.Result;
import com.start.workflow.core.manage.StartActFormManager;
import com.start.workflow.core.service.StartActModelConfigService;
import com.start.workflow.entity.StartActModelConfig;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Tag(name = "start流程表单API")
@RestController
@RequestMapping("/startActFormApi")
public class StartActFormApi {
    @Autowired
    private StartActModelConfigService configService;

    @GetMapping("/getActFormOption/{configId}")
    public Result<?> getActFormOption(@PathVariable String configId) {
        StartActModelConfig config = configService.getById(configId);
        return Result.ok(StartActFormManager.getInstance().loadOption(config));
    }

}
